

import java.awt.Color;
import java.awt.Graphics2D;
import java.util.Random;

/**
 *
 * @author styfle
 */
public class MovingObject {
    public float speed;
    private float x;
    private float y;
    private String str;
    protected MovingObject next;
    int red;
    int green;
    int blue;

    public MovingObject(float xPos,float yPos, float speed,int r,int g, int b) {
        next = null;
        x = xPos;
        y = yPos;

        red = r;
        green = g;
        blue = b;

        Random rand = new Random();
        this.speed = speed;
        //char c = (char)(rand.nextInt(25)+97); //97-122
        char c = (char)122;

        str = Character.toString(c);
    }

    public void draw(Graphics2D g) {
        g.setColor(new Color(red,green,blue,210));
        g.drawString(str, x, y);
        x += speed; //moves at constant speed
        if (y > Main.w.height+10) y = -50; //repeats line
        if (x > Main.w.width+10) x = -50; // repeats line
    }

    public String getName() {
        return str;
    }

}
